/*** 
 * @_______________#########_______________________ 
 * @______________############_____________________ 
 * @______________#############____________________ 
 * @_____________##__###########___________________ 
 * @____________###__######_#####__________________ 
 * @____________###_#######___####_________________ 
 * @___________###__##########_####________________ 
 * @__________####__###########_####_______________ 
 * @________#####___###########__#####_____________ 
 * @_______######___###_########___#####___________ 
 * @_______#####___###___########___######_________ 
 * @______######___###__###########___######_______ 
 * @_____######___####_##############__######______ 
 * @____#######__#####################_#######_____ 
 * @____#######__##############################____ 
 * @___#######__######_#################_#######___ 
 * @___#######__######_######_#########___######___ 
 * @___#######____##__######___######_____######___ 
 * @___#######________######____#####_____#####____ 
 * @____######________#####_____#####_____####_____ 
 * @_____#####________####______#####_____###______ 
 * @______#####______;###________###______#________ 
 * @________##_______####________####______________ 
 * @
 * @Author: ipk518 18163976442@163.com
 * @Date: 2024-09-20 15:20:07
 * @LastEditors: ipk518 121206530@qq.com
 * @LastEditTime: 2025-06-09 09:04:44
 * @FilePath: /etws-sxk2307/inc/para-tr.h
 * @Description: 
 * @************佛祖保佑************
 * @Copyright (c) 2024 by etws@quyujiang, All Rights Reserved. 
 */

#ifndef _TR_H_
#define _TR_H_

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

#pragma pack(push,1)

typedef union
{
	uint16_t val;
	struct
	{
		uint16_t work_mode:2;//工作模式
		uint16_t pol_mode:2;//极化模式
		uint16_t beam_num:7;//波位数
		uint16_t child_beam:2;//子波位控制
		uint16_t rf_sw:1;//辐射开关
		uint16_t reserver:1;
		uint16_t rx_en:1;//接收通道使能
	}bit;
}tr_bram_data1_t;

typedef union
{
	uint16_t val;
	struct
	{
		uint16_t ch0_en:1;//通道使能
		uint16_t ch1_en:1;//通道使能
		uint16_t ch2_en:1;//通道使能
		uint16_t ch3_en:1;//通道使能
		uint16_t ch4_en:1;//通道使能
		uint16_t ch5_en:1;//通道使能
		uint16_t ch6_en:1;//通道使能
		uint16_t ch7_en:1;//通道使能

		uint16_t ch8_en:1;//通道使能
		uint16_t ch9_en:1;//通道使能
		uint16_t ch10_en:1;//通道使能
		uint16_t ch11_en:1;//通道使能
		uint16_t ch12_en:1;//通道使能
		uint16_t ch13_en:1;//通道使能
		uint16_t ch14_en:1;//通道使能
		uint16_t ch15_en:1;//通道使能
	}bit;
}tr_bram_data2_t;


typedef struct{
	uint16_t AD7616_0_CHA[8];//
	uint16_t AD7616_0_CHB[8];
	uint16_t AD7616_1_CHA[8];
	uint16_t AD7616_1_CHB[8];
	uint16_t AD7616_2_CHA[8];
	uint16_t AD7616_2_CHB[8];
	uint16_t AD7616_3_CHA[8];
	uint16_t AD7616_3_CHB[8];
	uint16_t AD7616_4_CHA_NC[8];
	uint16_t AD7616_4_CHB_NC[8];
	uint16_t AD7616_4_CHA_NO[8];
	uint16_t AD7616_4_CHB_NO[8];

	uint16_t DATA0;//脉冲宽度
	tr_bram_data1_t DATA1;
	tr_bram_data2_t DATA2;
	uint16_t DATA3;
	uint16_t DATA4;
}tr_pl_bram_t;

typedef struct{
	uint32_t Project_code;                 //项目代号
	uint32_t Components;                   //组件
	uint32_t Compilation_platform;         //编译平台
	uint32_t Compilation_Platform_UUID1;    //编译平台 UUID
	uint32_t Compilation_Platform_UUID2;    //编译平台 UUID
	uint32_t Compilation_Platform_UUID3;    //编译平台 UUID
	uint32_t Compilation_Platform_UUID4;    //编译平台 UUID
	uint32_t Compilation_date;             //编译日期
	uint32_t Compilation_time;             //编译时间
	uint32_t Project_version_number;       //工程版本号
	uint32_t Engineering_sub_version_number;       //工程子版本号
	uint32_t Vivado_version;                       //vivado版本
	uint32_t Vivado_sub_version;                   //vivado子版本
}tr_pl_version_t;

typedef struct{
	uint8_t stc_mode;	//	STC模式

	uint16_t stc_distance0;	//	STC距离0
	uint8_t stc_attenuation0;	//	STC衰减0
	uint16_t stc_distance1;	//	STC距离1
	uint8_t stc_attenuation1;	//	STC衰减1
	uint16_t stc_distance2;	//	STC距离2
	uint8_t stc_attenuation2;	//	STC衰减2
	uint16_t stc_distance3;	//	STC距离3
	uint8_t stc_attenuation3;	//	STC衰减3
	uint16_t stc_distance4;	//	STC距离4
	uint8_t stc_attenuation4;	//	STC衰减4
	uint16_t stc_distance5;	//	STC距离5
	uint8_t stc_attenuation5;	//	STC衰减5
	uint16_t stc_distance6;	//	STC距离6
	uint8_t stc_attenuation6;	//	STC衰减6
	uint16_t stc_distance7;	//	STC距离7
	uint8_t stc_attenuation7;	//	STC衰减7

	uint8_t working_mode;	//	单板测试工作模式设置
	uint8_t wave_number;	//	单板测试波位数设置
	uint8_t polarization_direction;	//	单板测试发射通道极化方向设置
	uint8_t polarization_mode;	//	单板测试极化模式设置
	uint16_t amplifier_switch;	//	单板测试功放通道开关设置
	uint8_t RF_switch;	//	单板测试接收射频通道开关设置
	uint8_t pulse_low;	//	单板测试脉宽低字节
	uint8_t pulse_high;	//	单板测试脉宽高字节
	uint8_t radiation_switch;	//	单板辐射通总开关设置
	uint16_t protection_register;	//	通道保护寄存器
	uint8_t wavelet_bit_control;	//	单板测试子波位控制寄存器
	uint8_t parameter_flags;	//	单板测试发射校准叠加赋性参数标志位
	uint16_t pwm;	//	发射PWM信号 占空比
}tr_pl_single_board_t;

typedef struct{
	uint16_t m_major;
	uint16_t m_minor;
	uint16_t m_patch;
	uint16_t m_year;
	uint16_t m_month;
	uint16_t m_data;
}tr_ps_version_t;

typedef struct 
{
	float val1;
	float val2;
}tr_ps_temperature_t;

typedef struct{
	tr_ps_version_t version;
	tr_ps_temperature_t temperature;
	float cpu_temperature;
}tr_ps_systempara_t;

typedef struct{
	tr_pl_bram_t bram; //只读
    tr_pl_version_t version;//只读
    tr_pl_single_board_t single_board;//可读可写 注意线程冲突
}tr_pl_systempara_t;

typedef struct{
    tr_ps_systempara_t ps;
    tr_pl_systempara_t pl;
}tr;

#pragma pack(pop)

#endif // !_





